/*
 * @desc:
 * @LastEditTime: 2022-10-24 10:27:50
 * @params:
 * @return::
 */
import { defineStore } from 'pinia'
import piniaPersistConfig from '../../config/piniaPersist'
import { Names } from '../store-namespace'
import { userState } from '../interface'

export const useUserStore = defineStore(Names.Info, {
  state: (): userState => {
    return {
      openid: '',
      token: '',
      avatarUrl: '',
      nickName: '',
      country: '',
      province: '',
      userName: '',
      phoneNum: 0,
      sex: '',
      city: '',
      favouriteAuthor: [],
      follows: [],
    }
  },
  //类似于computed 可以帮我们去修饰我们的值
  getters: {},
  //可以操作异步 和 同步提交state
  actions: {},
  persist: piniaPersistConfig(Names.User),
})
